package shuashuami.hb.com.avtivity;

import android.util.Log;

import java.util.List;

import shuashuami.hb.com.hbclient.R;
import shuashuami.hb.com.listener.IMenuBtnClickListener;
import shuashuami.hb.com.manager.HbAppManager;
import shuashuami.hb.com.model.HbMenuInfo;

/**
 * <b>类   名：</b>${TYPE_NAME} <br/>
 * <b>类描述：</b> <br/>
 * <b>创建人：</b>zhangqi<br/>
 * <b>创建时间：</b>2017/6/13<br/>
 * <b>修改人：</b>zhangqi<br/>
 * <b>修改时间：</b>2017/6/13<br/>
 * <b>修改备注：</b><br/>
 *
 * @version 1.0.0<br/>
 */
public class HbMainAct extends AbActivity implements IMenuBtnClickListener{


    int currentPage=-1;

    @Override
    protected void initUI() {
        setAbContentView(R.layout.act_main);
        setBottomBar();

    }



    @Override
    protected void initData() {
        List<HbMenuInfo> menuInfos= HbAppManager.getInstance().getMenuInfos();
        for(int i=0;i<menuInfos.size();i++){
            bottomBar.addMenuItem(menuInfos.get(i));

        }
        onMenuBtnClick(0);
    }

    @Override
    protected void initListener() {
        bottomBar.registerClickListener(this);
    }

    @Override
    public void onMenuBtnClick(int tag) {

        if (currentPage == tag) return;
        currentPage = tag;
        HbMenuInfo info = HbAppManager.getInstance().getMenuInfos().get(currentPage);

//        if (info.getmName().equals("分享验证码") || info.getmName().equals("我的")) {
//            hideTitleBar();
//        } else {
//            showTitleBar();
//
//        }


        smartFragmentReplace(R.id.main_content, info.getmFragment());

//        mAbTitleBar.setTitleText(info.getmName());

        Log.i("zq", tag + "");

    }
}
